In [ ]:
%pip install pandas numpy plotly ipykernel --user
Requirement already satisfied: pandas in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (2.1.4) Requirement already satisfied: numpy in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (1.26.2) Requirement already satisfied: plotly in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (5.18.0) Requirement already satisfied: ipykernel in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (6.27.1) Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from pandas) (2.8.2) Requirement already satisfied: pytz>=2020.1 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from pandas) (2023.3.post1) Requirement already satisfied: tzdata>=2022.1 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from pandas) (2023.3) Requirement already satisfied: tenacity>=6.2.0 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from plotly) (8.2.3) Requirement already satisfied: packaging in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from plotly) (23.2) Requirement already satisfied: comm>=0.1.1 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (0.2.0) Requirement already satisfied: debugpy>=1.6.5 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (1.8.0) Requirement already satisfied: ipython>=7.23.1 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (8.19.0) Requirement already satisfied: jupyter-client>=6.1.12 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (8.6.0) Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (5.5.1) Requirement already satisfied: matplotlib-inline>=0.1 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (0.1.6) Requirement already satisfied: nest-asyncio in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (1.5.8) Requirement already satisfied: psutil in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (5.9.7) Requirement already satisfied: pyzmq>=20 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (25.1.2) Requirement already satisfied: tornado>=6.1 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (6.4) Requirement already satisfied: traitlets>=5.4.0 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipykernel) (5.14.0) Requirement already satisfied: decorator in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipython>=7.23.1->ipykernel) (5.1.1) Requirement already satisfied: jedi>=0.16 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipython>=7.23.1->ipykernel) (0.19.1) Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipython>=7.23.1->ipykernel) (3.0.43) Requirement already satisfied: pygments>=2.4.0 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipython>=7.23.1->ipykernel) (2.17.2) Requirement already satisfied: stack-data in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipython>=7.23.1->ipykernel) (0.6.3) Requirement already satisfied: colorama in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ipython>=7.23.1->ipykernel) (0.4.6) Requirement already satisfied: platformdirs>=2.5 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (4.1.0) Requirement already satisfied: pywin32>=300 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (306) Requirement already satisfied: six>=1.5 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0) Requirement already satisfied: parso<0.9.0,>=0.8.3 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from jedi>=0.16->ipython>=7.23.1->ipykernel) (0.8.3) Requirement already satisfied: wcwidth in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=7.23.1->ipykernel) (0.2.12) Requirement already satisfied: executing>=1.2.0 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (2.0.1) Requirement already satisfied: asttokens>=2.1.0 in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (2.4.1) Requirement already satisfied: pure-eval in c:\users\looper\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (0.2.2) Note: you may need to restart the kernel to use updated packages.
In [ ]:
import pandas as pd
import plotly
import plotly.express as px
import numpy as np
data = pd.read_csv("spotify-2023.csv")
data
Out[ ]:
| track_name | artist(s)_name | artist_count | released_year | released_month | released_day | in_spotify_playlists | in_spotify_charts | streams | in_apple_playlists | ... | bpm | key | mode | danceability_% | valence_% | energy_% | acousticness_% | instrumentalness_% | liveness_% | speechiness_% | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Seven (feat. Latto) (Explicit Ver.) | Latto, Jung Kook | 2 | 2023 | 7 | 14 | 553 | 147 | 141381703 | 43 | ... | 125 | B | Major | 80 | 89 | 83 | 31 | 0 | 8 | 4 |
| 1 | LALA | Myke Towers | 1 | 2023 | 3 | 23 | 1474 | 48 | 133716286 | 48 | ... | 92 | C# | Major | 71 | 61 | 74 | 7 | 0 | 10 | 4 |
| 2 | vampire | Olivia Rodrigo | 1 | 2023 | 6 | 30 | 1397 | 113 | 140003974 | 94 | ... | 138 | F | Major | 51 | 32 | 53 | 17 | 0 | 31 | 6 |
| 3 | Cruel Summer | Taylor Swift | 1 | 2019 | 8 | 23 | 7858 | 100 | 800840817 | 116 | ... | 170 | A | Major | 55 | 58 | 72 | 11 | 0 | 11 | 15 |
| 4 | WHERE SHE GOES | Bad Bunny | 1 | 2023 | 5 | 18 | 3133 | 50 | 303236322 | 84 | ... | 144 | A | Minor | 65 | 23 | 80 | 14 | 63 | 11 | 6 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 948 | My Mind & Me | Selena Gomez | 1 | 2022 | 11 | 3 | 953 | 0 | 91473363 | 61 | ... | 144 | A | Major | 60 | 24 | 39 | 57 | 0 | 8 | 3 |
| 949 | Bigger Than The Whole Sky | Taylor Swift | 1 | 2022 | 10 | 21 | 1180 | 0 | 121871870 | 4 | ... | 166 | F# | Major | 42 | 7 | 24 | 83 | 1 | 12 | 6 |
| 950 | A Veces (feat. Feid) | Feid, Paulo Londra | 2 | 2022 | 11 | 3 | 573 | 0 | 73513683 | 2 | ... | 92 | C# | Major | 80 | 81 | 67 | 4 | 0 | 8 | 6 |
| 951 | En La De Ella | Feid, Sech, Jhayco | 3 | 2022 | 10 | 20 | 1320 | 0 | 133895612 | 29 | ... | 97 | C# | Major | 82 | 67 | 77 | 8 | 0 | 12 | 5 |
| 952 | Alone | Burna Boy | 1 | 2022 | 11 | 4 | 782 | 2 | 96007391 | 27 | ... | 90 | E | Minor | 61 | 32 | 67 | 15 | 0 | 11 | 5 |
953 rows × 24 columns
In [ ]:
realeased_year_group = data.groupby("released_year")
max_streams = realeased_year_group["streams"].idxmax()
new_data = data.loc[max_streams]
px.bar(new_data , x="released_year", y = "streams").show(renderer="notebook")
In [ ]:
data[data['artist(s)_name'].str.contains("morad")]
data[data['track_name'].str.contains("seya")]
Out[ ]:
| track_name | artist(s)_name | artist_count | released_year | released_month | released_day | in_spotify_playlists | in_spotify_charts | streams | in_apple_playlists | ... | bpm | key | mode | danceability_% | valence_% | energy_% | acousticness_% | instrumentalness_% | liveness_% | speechiness_% |
|---|
0 rows × 24 columns
In [ ]:
data["fire"]= data["energy_%"]-data['acousticness_%']+data['valence_%']+data ['danceability_%' ]-data['instrumentalness_%' ]
fire_limit=np.median(data['fire'])
data["size"] = np.maximum(data["fire"],5)
px.scatter(data , x="fire", y = "streams",hover_data=["track_name","artist(s)_name","artist_count"],
title="bimba",color="fire",size="size" ).show(renderer="notebook")